#!/bin/python3

import sys
import os
import unittest

if len(sys.argv) < 2:
  print("You must provide the prenstar library path.")
  sys.exit(1)
else:
  sys.path.insert(0, os.path.dirname(sys.argv[1]))

import prenstar

class GetImportExtensionsTest(unittest.TestCase):

  def test_get_output(self):
    self.assertNotEqual(prenstar.get_import_extensions(), "",
        msg="get_import_extensions don't return anything.")

class Translate(unittest.TestCase):

  def test_get_output_file_ply_to_stl(self):
    self.assertTrue(prenstar.translate_mesh(sys.argv[2], 'output.stl'))
    self.assertTrue(os.path.exists('output.stl'))

  def test_get_output_file_stl_to_ply(self):
    self.assertTrue(prenstar.translate_mesh(sys.argv[3], 'output.ply'))
    self.assertTrue(os.path.exists('output.ply'))

if __name__ == '__main__':
  unittest.main(argv=[sys.argv[0]])

